package com.woniu.postbar.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.common.constant.PostBarConstant;
import com.woniu.common.entity.ResultCode;
import com.woniu.common.exception.LifeException;
import com.woniu.postbar.mapper.PostComplaintMapper;
import com.woniu.postbar.pojo.PostAdmin;
import com.woniu.postbar.pojo.PostComplaint;
import com.woniu.postbar.service.IPostComplaintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author wu
 * @since 2023-05-20
 */
@Service
public class PostComplaintServiceImpl extends ServiceImpl<PostComplaintMapper, PostComplaint> implements IPostComplaintService {

    @Autowired
    private PostComplaintMapper postComplaintMapper;


    @Override
    public List<PostComplaint> addPostComplaint(PostComplaint postComplaint) {
        if(postComplaint.getProcess() == PostBarConstant.PROCESS){
            List<PostComplaint> postComplaints = postComplaintMapper.addPostComplaint(postComplaint);
            return postComplaints;
        }
        throw new LifeException(ResultCode.USER_COMPLAINT_ERROR.getMessage());
    }
}
